/**
 *  Copyright (c)  2011-2020 Panguso, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Panguso, 
 *  Inc. ("Confidential Information"). You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into with Panguso.
 */

package cn.edu.thu.log.preprocessrule;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * save the log clean rule
 * 
 * @author wan
 * 
 */
public class LogCleanRule {
	// Map的键值分别对应字段名和它的正则表f达式
	private Map<String, String> logCleanRules = null;
	// private Set<Map<String,String>> logCleanRules=null;
	private ArrayList<String> tagformat;
	private String tagname;
	private String expression;
/**
 * 
 */
	public LogCleanRule() {
		// logCleanRules=new HashSet<Map<String,String>>();
		logCleanRules = new HashMap<String, String>();
	}
/**
 * 
 * @param newtagname parameter
 * @param newexpression parameter
 */
	// 添加需要日志清洗的字段
	public void addLogCleanRule(String newtagname, String newexpression) {
		this.tagname = newtagname;
		this.expression = newexpression;
		// tagFormat=new HashMap<String,String>();
		if (!logCleanRules.containsKey(newtagname)) {
			logCleanRules.put(newtagname, newexpression);
		}
		// System.out.println("Already give the format of the tagname"+tagname);

	}

	// 返回所有要进行日志清洗的字段
	public Map<String, String> getAllLogCleanRules() {
		// System.out.println(logCleanRules.toString());
		return logCleanRules;
	}
/**
 * 
 * @return
 */
	public ArrayList<String> getTagFormat() {
		tagformat = new ArrayList<String>();
		tagformat.add(tagname);
		tagformat.add(expression);
		return tagformat;
	}

	public Map<String, String> getLogCleanRules() {
		return logCleanRules;
	}

	public void setLogCleanRules(Map<String, String> logCleanRules) {
		this.logCleanRules = logCleanRules;
	}

	public ArrayList<String> getTagformat() {
		return tagformat;
	}

	public void setTagFormat(ArrayList<String> newtagformat) {
		this.tagformat = newtagformat;
	}

	public String getTagname() {
		return tagname;
	}

	public void setTagname(String tagname) {
		this.tagname = tagname;
	}

	public String getExpression() {
		return expression;
	}

	public void setExpression(String expression) {
		this.expression = expression;
	}

}
